<!DOCTYPE html>
<html lang="zh-CN">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Title</title>
    <script src="../js/vue.js"></script>
</head>

<body>
    <!-- 作用域插槽 -->
    <div id="app">
        <cpn></cpn>

        <cpn>
            <!-- 获取子组件中的数据并展示 
                
            -->
            <template slot-scope="slot">
                <span v-for="item in slot.languages">{{item}}--------</span>

                <br>
                <span>{{slot.languages.join('==')}}</span>
            </template>
        </cpn>
        <cpn></cpn>
    </div>

    <template id="CPN">
        <div>
            <slot :languages="pLanguages">
                <ul>
                    <li v-for="item in pLanguages">{{item}}</li>
                </ul>
            </slot>
            
        </div>
    </template>
    <script>
        const vm = new Vue({
            el: '#app',
            data: {
                message: '我是你爹!'
            },
            methods: {},
            components: {
                cpn: {
                    template: '#CPN',
                    data() {
                        return {
                            pLanguages: ['JavaScript', 'Java', 'C++', 'C#', 'Python', 'Go', ]
                        }
                    }
                }
            }
        });
    </script>
</body>

</html>